package com.zhumei.keyscale.widget;

import android.content.*;
import android.view.*;
import android.util.*;
import androidx.recyclerview.widget.*;

public class FocusLinearLayoutManager extends GridLayoutManager
{
    public FocusLinearLayoutManager(final Context context, final int n) {
        super(context, n);
    }
    
    public FocusLinearLayoutManager(final Context context, final int n, final int n2, final boolean b) {
        super(context, n, n2, b);
    }
    
    public FocusLinearLayoutManager(final Context context, final AttributeSet set, final int n, final int n2) {
        super(context, set, n, n2);
    }
    
    @Override
    public View onInterceptFocusSearch(final View view, final int n) {
        Log.v("manger", "ssssss");
        int position = ((RecyclerView.LayoutManager)this).getPosition(((RecyclerView.LayoutManager)this).getFocusedChild());
        final int itemCount = ((RecyclerView.LayoutManager)this).getItemCount();
        final int lastVisibleItemPosition = this.findLastVisibleItemPosition();
        if (n == 17 || n == 33 || n == 66 || n == 130) {
            ++position;
        }
        View onInterceptFocusSearch = view;
        if (position >= 0) {
            if (position > itemCount) {
                return view;
            }
            if (position > lastVisibleItemPosition) {
                this.scrollToPosition(position);
            }
            onInterceptFocusSearch = super.onInterceptFocusSearch(view, n);
        }
        return onInterceptFocusSearch;
    }
}
